package com.smt.threenationkill.tag;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.SimpleTagSupport;

import com.smt.threenationkill.domain.ByRole;
import com.smt.threenationkill.domain.GameStat;
import com.smt.threenationkill.domain.Player;
import com.smt.threenationkill.enums.Role;

public class PointTag extends SimpleTagSupport{

	private ByRole player;
	private Role role;
	
	public void setPlayer(ByRole player) {
		this.player = player;
	}
	
	public void setRole(String role) {
		this.role = Role.valueOf(role);
		if (this.role == null){
			throw new IllegalArgumentException("Unknown role:"+role);
		}
	}
	
	public void doTag() throws JspException, IOException{
		getJspContext().getOut().print(String.valueOf(player.getPointsByRole(role)));
	}
	
}
